package com.ruoyi.shop.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.shop.mapper.PromotionalMapper;
import com.ruoyi.shop.domain.Promotional;
import com.ruoyi.shop.service.IPromotionalService;

/**
 * 宣传主图Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-10-30
 */
@Service
public class PromotionalServiceImpl implements IPromotionalService 
{
    @Autowired
    private PromotionalMapper promotionalMapper;

    /**
     * 查询宣传主图
     * 
     * @param id 宣传主图主键
     * @return 宣传主图
     */
    @Override
    public Promotional selectPromotionalById(Long id)
    {
        return promotionalMapper.selectPromotionalById(id);
    }

    /**
     * 查询宣传主图列表
     * 
     * @param promotional 宣传主图
     * @return 宣传主图
     */
    @Override
    public List<Promotional> selectPromotionalList(Promotional promotional)
    {
        return promotionalMapper.selectPromotionalList(promotional);
    }

    /**
     * 新增宣传主图
     * 
     * @param promotional 宣传主图
     * @return 结果
     */
    @Override
    public int insertPromotional(Promotional promotional)
    {
        promotional.setCreateTime(DateUtils.getNowDate());
        return promotionalMapper.insertPromotional(promotional);
    }

    /**
     * 修改宣传主图
     * 
     * @param promotional 宣传主图
     * @return 结果
     */
    @Override
    public int updatePromotional(Promotional promotional)
    {
        promotional.setUpdateTime(DateUtils.getNowDate());
        return promotionalMapper.updatePromotional(promotional);
    }

    /**
     * 批量删除宣传主图
     * 
     * @param ids 需要删除的宣传主图主键
     * @return 结果
     */
    @Override
    public int deletePromotionalByIds(Long[] ids)
    {
        return promotionalMapper.deletePromotionalByIds(ids);
    }

    /**
     * 删除宣传主图信息
     * 
     * @param id 宣传主图主键
     * @return 结果
     */
    @Override
    public int deletePromotionalById(Long id)
    {
        return promotionalMapper.deletePromotionalById(id);
    }
}
